populate()

Populate the control. Because many aspects of dictionary object can be changed by the xpertrule developer, the control must be able to reflect these changes. For this reason, the control setup is split into init (to create the static control DOM elements) and populate (to create / set the dynamic control elements).

n.b. populate is called multiple times across the life cycle of the dialog (where as init is called just once). For this reason it's good to make sure the populate method is as performant as possible

The populate method also needs to access the dictionary to retrieve attributes such as current value, list values, visibility state etc. This is achieved via the "dictionary" object. There follows an example of some common operations...

// Find a dictionary object based on the ID held in the tieditem property of the control definition
var o = dictionary.GetObject(data.definition.tieditem);
// Get the current selected value of a dictionary object
var aVal = o.GetValue();
// Check the isvisible object control property of a dictionary object
if ( !o.flatProps.isvisible )

One final function of the populate method is to visually reflect the valid state of the control (see validate method below for more information). The convention is to put a red border around the control is it is not valid.